package de.leuphana.internet.view;


import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class BuchladenServlet
 */
public abstract class BuchladenServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	protected PrintWriter out;

    /**
     * Default constructor. 
     */
    public BuchladenServlet() {
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html");
		
		out = response.getWriter();
		response.setCharacterEncoding("UTF-8");

		druckeKopf("");
		druckeInhalt();
		druckeFuss();

		out.close();
	}

	protected void druckeKopf(String titel) {
		out.println("<html>");
		out.println("<head>");
		out.println("<title>titel</title>");
		out.println("</head>");
		out.println("<body>");
	}
	
	protected abstract void druckeInhalt();

	
	protected void druckeFuss() {
		out.println("</body>");
		out.println("</html>");
	}

}